package 11281.java;
//力扣704
public class 11281 {
    class Solution {
        public int search(int[] nums, int target) {
            int n=nums.length;
            int zuo=0;
            int you=n-1;
            int mad;
            while(true){
                mad=(zuo+you)/2;
                if(nums[mad]>target){
                    you=mad-1;
                }else if(nums[mad]<target){
                    zuo=mad+1;
                }else return mad;
                if(zuo>you){
                    return -1;
                }
            }
            
            
        }
    }
}
